import { Controller, Get, Post, Body, Param } from '@nestjs/common';
import { UserService } from './user.service';
import { CreateUserDto } from './dto/create-user.dto';
import { UpdateUserDto } from './dto/update-user.dto';
import { LoginUserDto } from './dto/login-user.dto';
import { ApiBody, ApiOperation, ApiQuery } from '@nestjs/swagger';

@Controller('user')
export class UserController {
    constructor(private readonly userService: UserService) {}

    @Post('/register')
    @ApiBody({ type: CreateUserDto, description: '用户注册接口' })
    @ApiOperation({
        summary: '注册',
        description: '用户账户注册接口',
    })
    register(@Body() createUserDto: CreateUserDto) {
        return this.userService.register(createUserDto);
    }

    @Post('/login')
    @ApiOperation({
        summary: '登录',
        description: '登录接口',
    })
    login(@Body() loginUserDto: LoginUserDto) {
        return this.userService.login(loginUserDto);
    }
}
